ChartMarkProps
ChartMarkProps defines a set of visual and behavioral modifiers applicable to individual chart marks such as bars, lines, or areas. These modifiers allow developers to customize the appearance, layout, and dynamic behavior of chart elements in BarChart, LineChart, AreaChart, and other mark-based components.
1. Style Modifiers
foregroundStyle
Specifies the fill style of the chart content.
-
Type:
ShapeStyle | DynamicShapeStyle -
Example:
opacity
Sets the opacity of the mark, ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
-
Type:
number -
Example:
cornerRadius
Sets the corner radius for shapes such as bars or capsules.
-
Type:
number -
Example:
lineStyle
Applies stroke styles for line marks.
-
Type:
StrokeStyle -
Structure:
-
Example:
interpolationMethod
Controls how lines or areas interpolate between data points.
-
Type:
ChartInterpolationMethod -
Options:
"cardinal","catmullRom","linear","monotone","stepCenter","stepEnd","stepStart" -
Example:
alignsMarkStylesWithPlotArea
Determines whether styles align with the chart’s plot area.
-
Type:
boolean -
Example:
2. Symbol Configuration (for Line/Scatter Charts)
symbol
Sets a symbol type or a custom view as the plotting symbol.
-
Type:
ChartSymbolShape | VirtualNode -
Options:
"circle","square","triangle","diamond","cross","plus","asterisk","pentagon" -
Example:
symbolSize
Controls the symbol’s size.
-
Type:
number | { width: number; height: number } -
Example:
3. Annotations
annotation
Adds an annotation view positioned relative to a mark.
-
Type:
VirtualNode | { position?, alignment?, spacing?, overflowResolution?, content } -
Structure:
-
Example:
AnnotationPosition
Defines where the annotation is placed relative to the mark.
-
Type: string
-
Values:
"automatic""top","topLeading","topTrailing""bottom","bottomLeading","bottomTrailing""leading","trailing""overlay"(overlay the mark itself)
AnnotationOverflowResolutionStrategy
Specifies how to handle annotation layout overflow.
-
Type: string
-
Values:
"automatic": Selects the best resolution strategy automatically"fit": Adjusts the annotation to stay within the boundary"fitToPlot": Fits annotation within the plot area"fitToChart": Fits within the full chart bounds"fitToAutomatic": Automatically chooses between chart and plot bounds"padScale": Extends the chart scale to fit the annotation"disabled": Disables overflow resolution (allows clipping)
4. Shape Effects
clipShape
Applies a clipping shape to the mark.
-
Type:
'rect' | 'circle' | 'capsule' | 'ellipse' | 'buttonBorder' | 'containerRelative' -
Example:
shadow
Adds a drop shadow to the mark.
-
Type:
-
Example:
blur
Applies a Gaussian blur effect.
-
Type:
number -
Example:
zIndex
Controls the rendering order of the mark relative to others.
-
Type:
number -
Example:
offset
Offsets the mark in one or more dimensions.
-
Supported formats:
{ x, y }{ x, yStart, yEnd }{ xStart, xEnd, y }{ xStart, xEnd, yStart, yEnd }
-
Example:
5. Dynamic Data Mapping (xxxBy)
These properties dynamically bind mark appearance or position to data fields. They should not be used in combination with their corresponding static properties (e.g. foregroundStyleBy vs. foregroundStyle).
foregroundStyleBy
Maps a data field to a foreground style.
-
Type:
string | number | Date | { value, label } -
Example:
lineStyleBy
Maps a data field to a line style.
-
Example:
positionBy
Maps a data field to mark position and axis alignment.
-
Type:
-
Example:
MarkDimension
Controls the spacing or sizing behavior of the mark within its axis.
-
Type:
"automatic"or an object: -
Explanation:
"automatic": Lets the system determine the size"inset": Shrinks the size by an inset margin"fixed": Fixed screen-space size (in points)"ratio": Relative to available axis spacing (0 to 1)
symbolBy
Maps a field to different symbol shapes.
-
Example:
symbolSizeBy
Maps a field to symbol size.
-
Example:
